import request from '@/utils/request'

export function statistical() {
  return request({
    url: '/api/data/v1/count/host',
    method: 'get'
  })
}

export function alarmHour24() {
  return request({
    url: '/api/data/v1/count/alarm/24h',
    method: 'get'
  })
}
export function getLastAlarmEvent() {
  return request({
    url: '/api/data/v1/event/list?eventTypeFilter=alarm&pageNumber=1&pageSize=10',
    method: 'get',
    headers: {
      token: '123'
    }
  })
}
export function dateFormat(originVal) {
  const dt = new Date(originVal)
  const hh = (dt.getHours() + '').padStart(2, '0')
  return `${hh}时`
}
export function dateFormat2(originVal) {
  const dt = new Date(originVal)
  const m = (dt.getMonth() + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')

  return `${m}-${d} ${hh}:${mm}`
}
export function getHostList() {
  return request({
    url: '/api/data/v1/host/list',
    method: 'get',
    headers: {
      token: '123'
    }
  })
}
